package interfaces;

interface Process {
    default String name() {
        return getClass().getSimpleName();
    }

    Object process(Object obj);
}

class UpCase implements Process {
    @Override
    public String process(Object obj) {
        return ((String) obj).toUpperCase();
    }
}

class DownCase implements Process {
    @Override
    public String process(Object obj) {
        return ((String) obj).toLowerCase();
    }
}

public class Test {
    public static void process(Process process, Object obj) {
        System.out.println("Using " + process.name());
        System.out.println(process.process(obj));
    }

    public static void main(String[] args) {
        String str = "Hello World!";
        Process[] processes = {new UpCase(), new DownCase()};
        for (Process process : processes) {
            process(process, str);
        }
    }
}
